package com.service.impl;

import com.bean.Stock;
import com.dao.StockMapper;
import com.service.StockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 库存表实现类
 */
@Service("Stock")
public class StockServiceImpl implements StockService {

    @Autowired
    private StockMapper stockMapper;
    @Override
    public int save(Stock stock) {
        return stockMapper.insert(stock);
    }

    @Override
    public int remove(Stock stock) {
        return stockMapper.delete(stock);
    }

    @Override
    public int modify(Stock stock) {
        return stockMapper.update(stock);
    }

    @Override
    public List<Stock> find(Stock stock) {
        return stockMapper.select(stock);
    }

    @Override
    public int count(Map<String, Object> map) {
        return stockMapper.selectCount(map);
    }

    @Override
    public List<Stock> query(Map<String, Object> map) {
        return stockMapper.selectByPage(map);
    }
}
